/*
Copyright (c) [2024] [423109070325 FuZhifeng.etc]
[OVERPASS] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan
PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#pragma once
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <vector>
#include <string>

using namespace std;

typedef struct {
	int weight;
	int parent, lchild, rchild;
}HTNode, * HuffmanTree;

void Select(HuffmanTree& HT, int end, int& s1, int& s2);
void CreateHuffmanTree(HuffmanTree& HT, int n);
int CalculateWPL(HuffmanTree HT, int n);